package com.bjpowernode.controller;

import com.bjpowernode.result.NameValueData;
import com.bjpowernode.result.Result;
import com.bjpowernode.result.SummaryData;
import com.bjpowernode.service.StatisticsService;
import jakarta.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StatisticsController {

    @Resource
    private StatisticsService statisticsService;

    @GetMapping("/api/summary/data")
    public Result getSummaryData() {
        SummaryData summaryData = statisticsService.getSummaryData();

        return Result.OK(summaryData);
    }


    /**
     * 销售漏斗
     */
    @GetMapping("/api/sale/funnel")
    public Result saleFunnel() {
        List<NameValueData> nameValueDataList =  statisticsService.getSaleFunnelData();

        return Result.OK(nameValueDataList);
    }

    /**
     * 线索来源饼图
     */
    @GetMapping("/api/clue/pie")
    public Result cluePie() {
        List<NameValueData> nameValueDataList = statisticsService.getCluePieData();
        return Result.OK(nameValueDataList);
    }
}
